#include <iostream>
#include <unistd.h>
#include "pthread.hpp"
#include "Task.hpp"
#include "ThreadPool.hpp"

// 主线程负责创建与启动线程池，最终关闭线程池
int main()
{
    srand(time(nullptr));
    threadpool<Task> tp(5);
    tp.InitThreads();
    tp.StartAll();
    int cnt = 1000;
    while (cnt--)
    {
        int a = rand() % 100;
        int b = rand() % 100;
        tp.enqueue(Task(a, b));
    }
    sleep(3);
    tp.Stop();
    tp.WaitAll();
    return 0;
}